# map 方法：等同于 map() 方法，将某些函数提交到fn中
import time
import random
from concurrent.futures import ThreadPoolExecutor


def eat(name):
    print(f'{name} is eating')
    time.sleep(random.randint(1, 10))
    print(f'{name} is done')
    return f"{name} 's result"


if __name__ == '__main__':
    with ThreadPoolExecutor(max_workers=5) as executor:
        req = executor.map(eat, range(10))
        print(list(i for i in req))
